using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using Common.Enum;

namespace Converters
{
	public class TabItemExperimentNameMultiConverter : IMultiValueConverter
	{
		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			string text = null;
			if (values.Length > 0 && values[0] != null && values[0] != DependencyProperty.UnsetValue && values[0] is string)
			{
				text = values[0].ToString().Replace("_", "__");
			}
			if (values.Length > 1 && values[1] != null && values[1] != DependencyProperty.UnsetValue && values[1] is EExperimentStatus && (EExperimentStatus)values[1] != EExperimentStatus.Completed)
			{
				text = "*" + text;
			}
			return text;
		}

		public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
		{
			return null;
		}
	}
}
